<?php
/**
 * The template used to display Comments
 *
 * The area of the page that contains both current comments
 * and the comment form.  The actual display of comments is
 * handled by a callback to dkret_comments_callback which is
 * located in 'library\functions\comments.php' file
 *
 * @package dkret3
 * @since 3.6
 */

	if ( 'comments.php' == basename( $_SERVER['SCRIPT_FILENAME'] ) )
		die( __( 'Please do not load this page directly. Thanks!', 'hybrid' ) );

	if ( !is_single() && !have_comments() && !comments_open() && !pings_open() )
		return;

    if ( post_password_required() ) : ?>
        <p class="alert password-protected"><?php _e( 'This post is protected. Enter the password to view any comments.', 'dkret' ); ?></p>
    <?php endif; ?>

    <?php if ( have_comments() ) : ?>

        <div id="comments">

            <h3 id="comments-number" class="comments-header"><?php comments_number( __( 'No Responses','dkret' ), __( 'One Response', 'dkret' ), __( '% Responses', 'dkret' ) );?></h3>
            <span class="write-comment-link">
                <a href="#respond" title="<?php _e( 'Write a Comment', 'dkret' ); ?>"><?php if ( comments_open() ) : ?><?php _e( 'Write a Comment', 'dkret' ); ?>&#187;<?php endif; ?></a></span>
            </span>

            <?php paginate_comments_links() ?>

            <?php /* dkret3 Hook */ do_action( 'dkret_before_comment_list' ); ?>
           
            <ol class="commentlist">

                <?php wp_list_comments( array( 'style' => 'ol', 'callback' => 'dkret_comments_callback' ) ); ?>

            </ol><!-- .commentlist -->

            <?php /* dkret3 Hook */ do_action( 'dkret_after_comment_list' ); ?>
            
            <?php paginate_comments_links() ?>

        </div><!-- #comments -->
                
	<?php else : ?>

		<?php if ( pings_open() && !comments_open() && is_single() ) : ?>

			<p class="comments-closed pings-open">
				<?php printf( __( 'Comments are closed, but <a href="%1$s" title="Trackback URL for this post">trackbacks</a> and pingbacks are open.', 'dkret' ), trackback_url( '0' ) ); ?>
			</p><!-- .comments-closed .pings-open -->

		<?php elseif ( !comments_open() && is_single() ) : ?>

			<p class="comments-closed">
				<?php _e( 'Comments are closed.', 'dkret' ); ?>
			</p><!-- .comments-closed -->

		<?php endif; ?>

	<?php endif; ?>
    
    <?php if ( comments_open() ) : ?>

        <?php comment_form(); ?>

    <?php endif; ?>